package com.giscloud.limp.entity;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 再审案件信息
 * 
 * @author giscloud
 * @email giscloud@giscloud.com
 * @date 2020-06-10 14:25:28
 */
@Data
public class CaseRetrial implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 再审案件ID
	 */
   private Integer caseRetrialId;
	/**
	 * 案件ID
	 */
   private Integer caseId;
	/**
	 * 再审案件号
	 */
   private String retrialCaseCode;
	/**
	 * 诉讼类型 1|主诉;2|被诉
	 */
   private Integer litigationType;
	/**
	 * 案由
	 */
   private Integer actionCause;
	/**
	 * 再审受理时间
	 */
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
   private Date retrialDate;
	/**
	 * 再审申请人
	 */
   private String retrialApplicant;
	/**
	 * 再审被申请人
	 */
   private String retrialRespondent;
	/**
	 * 第三人
	 */
   private String thirdParty;
	/**
	 * 诉讼标的额
	 */
   private BigDecimal litigationAmount;
	/**
	 * 诉讼请求
	 */
   private String litigationClaim;
	/**
	 * 是否是重大案件 1|是;2|否
	 */
   private Integer majorCaseFlag;
	/**
	 * 再审受理法院
	 */
   private String acceptanceCourt;
	/**
	 * 受理法院类型
	 */
   private String courtType;
	/**
	 * 办案人
	 */
   private String caseHandler;
	/**
	 * 办案人联系方式
	 */
   private String caseHandlerTel;
	/**
	 * 案件处理意见
	 */
   private String caseHandlingOpinions;
	/**
	 * 再审附件
	 */
   private String attachmentId;
	/**
	 * 再审附件收到时间
	 */
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
   private Date attachmentReceiveDate;
	/**
	 * 其它附件
	 */
   private String otherAttachmentId;

   private Integer statusCd;

   private Integer createdStaffId;

	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
   private Date createdDt;

   private Integer operateStaffId;

   private Date version;

	/**
	 * 被告人列表
	 */
	private List<Defendant> defendants;

	/**
	 * 原告人列表
	 */
	private List<Plaintiff> plaintiffs;

	/**
	 * 提醒日期
	 */
	private Date warnDate;
	/**
	 * 提醒内容
	 */
	private String warnContent;

public enum Column {
						caseRetrialId("case_retrial_id","caseRetrialId","INTEGER",false),
								caseId("case_id","caseId","INTEGER",false),
								retrialCaseCode("retrial_case_code","retrialCaseCode","VARCHAR",false),
								litigationType("litigation_type","litigationType","INTEGER",false),
								actionCause("action_cause","actionCause","INTEGER",false),
								retrialDate("retrial_date","retrialDate","DATE",false),
								retrialApplicant("retrial_applicant","retrialApplicant","VARCHAR",false),
								retrialRespondent("retrial_respondent","retrialRespondent","VARCHAR",false),
								thirdParty("third_party","thirdParty","VARCHAR",false),
								litigationAmount("litigation_amount","litigationAmount","NUMERIC",false),
								litigationClaim("litigation_claim","litigationClaim","VARCHAR",false),
								majorCaseFlag("major_case_flag","majorCaseFlag","INTEGER",false),
								acceptanceCourt("acceptance_court","acceptanceCourt","VARCHAR",false),
								courtType("court_type","courtType","VARCHAR",false),
								caseHandler("case_handler","caseHandler","VARCHAR",false),
								caseHandlerTel("case_handler_tel","caseHandlerTel","VARCHAR",false),
								caseHandlingOpinions("case_handling_opinions","caseHandlingOpinions","VARCHAR",false),
								attachmentId("attachment_id","attachmentId","VARCHAR",false),
								attachmentReceiveDate("attachment_receive_date","attachmentReceiveDate","DATE",false),
								otherAttachmentId("other_attachment_id","otherAttachmentId","VARCHAR",false),
								statusCd("status_cd","statusCd","INTEGER",false),
								createdStaffId("created_staff_id","createdStaffId","INTEGER",false),
								createdDt("created_dt","createdDt","TIMESTAMP",false),
								operateStaffId("operate_staff_id","operateStaffId","INTEGER",false),
								version("version","version","TIMESTAMP",false);
	    		private static final String BEGINNING_DELIMITER = "`";
	private static final String ENDING_DELIMITER = "`";
	private final String column;
	private final boolean isColumnNameDelimited;
	private final String javaProperty;
	private final String jdbcType;
	public String value() {
		return this.column;
	}
	public String getValue() {
		return this.column;
	}
	public String getJavaProperty() {
		return this.javaProperty;
	}
	public String getJdbcType() {
		return this.jdbcType;
	}
	Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
		this.column = column;
		this.javaProperty = javaProperty;
		this.jdbcType = jdbcType;
		this.isColumnNameDelimited = isColumnNameDelimited;
	}
	public String desc() {
		return this.getEscapedColumnName() + " DESC";
	}
	public String asc() {
		return this.getEscapedColumnName() + " ASC";
	}
	public static Column[] excludes(Column ... excludes) {
		ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
		if (excludes != null && excludes.length > 0) {
			columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
		}
		return columns.toArray(new Column[]{});
	}
	public String getEscapedColumnName() {
		if (this.isColumnNameDelimited) {
			return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
		} else {
			return this.column;
		}
	}
	public String getAliasedEscapedColumnName() {
		return this.getEscapedColumnName();
	}
  }

}
